﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WinForm_Dialog
{
    public partial class MainWnd : Form
    {
        public MainWnd()
        {
            InitializeComponent();
        }

        private void launchDialogButton_Click(object sender, EventArgs e)
        {
            DialogForm dlg = new DialogForm();
            dlg.ShowDialog();
        }

        private void launchFormButton_Click(object sender, EventArgs e)
        {
            DialogForm dlg = new DialogForm();
            dlg.Show();
        }

        private void launchMessage_Click(object sender, EventArgs e)
        {
            // Code is entered here that performs a calculation
            // Display a message box informing the user that the calculations 
            // are complete
            MessageBox.Show("The calculations are complete", "My Application",
            MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk);
        }

        private void exitApp_Click(object sender, EventArgs e)
        {
            // Display a message box asking users if they
            // want to exit the application.
            if (MessageBox.Show("Do you want to exit?", "My Application",
                  MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                  == DialogResult.Yes)
            {
                Application.Exit();
            }
        }

        private void dialogObjects_Click(object sender, EventArgs e)
        {
            DialogBoxObjects dlg = new DialogBoxObjects();
            DialogResult ret = dlg.ShowDialog();
            if (ret == DialogResult.OK)
            {
                MessageBox.Show(dlg.UserInformation.Email);
            }
        }
    }
}
